



print("-------------")
###############

# 整型
count = 10

# 浮点型
average = 89.5

# 字符型（length为1的字符串）
grade = 'A'

# 字符串
name = "Alice"

# 布尔型
is_passed = True

print("Count: ",count)
print("Average: ",average)
print("Grade: ",grade)
print("Name: ",name)
print("Passed: ",is_passed)

print("-------------")
################

# 初始赋值为整数
variable = 114
print(variable,type(variable))

# 重新赋值为浮点数
variable = 42.0
print(variable,type(variable))

print("-------------")
################

# python中的for循环
for i in range(5):
    print("Number:",i)

print("-------------")
################

i = 0
# 使用while打印0到4的数字
while i<5:
    print("Number:",i)
    i += 1

print("-------------")
################

# 迭代字符串
text = "Hello"
for char in text:
    print(char)

# 迭代列表
numbers = [10,20,30,40,50]
for number in numbers:
    print("Number: ",number)

print("-------------")
################

# 定义列表
numbers = [1,2,3,4,5]

# 直接遍历列表元素
for i, number in enumerate(numbers):
    print(f"Element {i}: {number}")

# 添加元素
numbers.append(6)

# 删除指定位置的元素
del numbers[2]

# 插入元素
numbers.insert(2,7)

# 输出列表
print("Updated List: ",numbers)    

print("-------------")
################

# 函数定义
def add(a,b):
    return a+b

# 函数调用
Sum = add(5,3)
print("Sum: ",Sum)

# 带有默认值的函数
def greet(name,message="Hello"):
    print(f"{message},{name}!")
    
greet("Alice")
greet("Bob","Welcome")

# 带有可变参数的函数
def sum_all(*args):
    total = sum(args)
    print("Total:",total)
    
sum_all(1,2,3,4,5,2341)

print("-------------")

